package com.tianya.forum.dao;

import com.tianya.forum.model.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface MessageMapper {
    int insert(Message row);

    int insertSelective(Message row);

    Message selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Message row);

    int updateByPrimaryKey(Message row);

    /**
     * 根据接收者Id查询所有站内信
     * @param receiveUserId 接收者Id
     * @return 站内信
     */
    List<Message> selectByReceiveUserId(@Param(value = "receiveUserId") Long receiveUserId);


    /**
     * 查询站内信未读数
     * @param receiveUserId 用户ID
     * @return 未读数
     */
    Integer selectUnreadCount (@Param(value = "receiveUserId") Long receiveUserId);

}